﻿
namespace Mulala.Cavan.Application.MainBoundedContext.LogModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Mulala.Cavan.Domain.MainBoundedContext.LogModule;
    using Mulala.Cavan.Domain.MainBoundedContext.MulalaModule;
    using Mulala.Cavan.Domain.MainBoundedContext.SearchModule;
    using Mulala.Cavan.Domain.MainBoundedContext.SecurityModule;
    using Mulala.Cavan.Domain.Seedwork;

    public class VisitHistoryAppService : BaseAppService<VisitHistory, VisitHistorySearch, IVisitHistoryRepository>, IVisitHistoryAppService
    {
        private IVisitHistoryRepository VisitHistoryRepository { get; set; }

        public BoolGenericResult<VisitHistory> AddVisitHistory(UserAccount interviewee, string ip, UserAccount visitor)
        {
            BoolGenericResult<VisitHistory> result = new BoolGenericResult<VisitHistory>();
            VisitHistory visitHistory = VisitHistoryFactory.CreateVisitHistory(interviewee, ip, DateTime.Now, DateTime.Now, visitor, DateTime.Now, visitor.Name);

            this.VisitHistoryRepository.Save(visitHistory);
            result.Object = visitHistory;

            return result;
        }
    }
}
